#include <iostream>
using namespace std;

int main()
{
    int n,m,r,i,counter=0,kecon=1;
    cout<<"how many kids: m=";
    cin>>m;
    cout<<"please input the number: n=";
    cin>>n;
    int str[m+1];
    for(i=0;i<m;i++)
    {
        str[i]=i+1;
    }
    str[i]=-1;
    for(r=0;counter!=(m-1);r++)
    {
        if(str[r]==0)
        {
            continue;
        }
        if(str[r]==-1)
        {
            r=-1;
            continue;
        }
        if(kecon==n)
        {
            str[r]=0;
            kecon=1;
            counter++;
            continue;
        }
        kecon++;
    }
    for(i=0;i<m;i++)
    {
        if(str[i]==0)
        {
            continue;
        }
        else
        {
            cout<<"the kid who win the game is the No."<<str[i]<<" kid"<<endl;
            break;
        }
    }

    return 0;
}
